<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title>请上传</title>
<style type="text/css">
body{font:11px Arial;margin-left:0px;margin-right:0px;margin-bottom:0px;background-image:url(images/g_24.jpg);}
table{font-family:Verdana,Arial,宋体;font-size:12px;FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#999999,strength=3);}
input{border:1px soild #000000;font-family:Verdana,Arial,宋体;font-size:12px;padding:2px;}
</style>
<script type="text/javascript" src="../dwr/engine.js"> </script>
<script type="text/javascript" src="../lovejes/lovejes.js"> </script>
<script type="text/javascript">
Jes.extend(Jes.Upload,{
	//upload.html上传页面
	init : function(){
		var req = Jes.request(),_w=req.width,_h=req.height,type=req.type;
		if(type=='img') Jes.html('tit','图片上传');
		else if(type=='video') Jes.html('tit','视频上传');
		if(_w) Jes.html('picinfo','水印<input type="checkbox" id="isP" name="isP" class="checkbox" value="1"/>压缩<input type="checkbox" id="isC" name="isC" class="checkbox" value="1"/>(不压缩请设置图片大小[宽'+_w+'-高'+_h+']象素)')
		form1.action='../upload.shtml'.J({type:req.type || 'BUSS','busType':req.busType,w:_w,h:_h});
	}
	,upload : function(){
		var req = Jes.request(),id=req.id,num=req.num,_len = Jes.opener().Jes.name(id+'.upname').length,type=req.type;
		var name =type=='img'?'图片':(type=='video'?'视频':'附件'),file = Jes('attachfile').value;
		//附件NUM限制
		if(num && num <=_len){alert('上传'+name+'不能超过'+num+"项");return;}
		if(file == ''){alert('上传'+name+'不能为空');return;}
		if(type=='img' && !file.isPic()){alert('上传图片格式必须是jpg或者gif');return;}
		Jes.show('pBar');
		Jes.html('pBTxt','上传进度: 0%');
    	Jes("pBBCont").style.width = "0px";
    	Jes.disBtn();
    	window.setTimeout("Jes.Upload._reProcess()", 1000);
    	//return true;
		form1.submit();
	}
	,again : function(){
		Jes('attachfile').outerHTML  = Jes('attachfile').outerHTML;
		Jes.hide('pBar');
	}
	,_reProcess : function(){
		Jes.action("getBussInfo","UPPROC_INFO",function(_d){
	    	if(_d){
	    		Jes.html("pBTxt",_d.procInfo);
	    		Jes("pBBCont").style.width = parseInt(_d.procPer * 2.16)+"px";
	    	}
			if (!_d || _d.isProcess){
				window.setTimeout("Jes.Upload._reProcess()", 100);
			}else{
				Jes("pBBCont").style.width = "216px";
				var h='<input type="button" value="继续上传" onclick="Jes.Upload.again();"/>&nbsp;&nbsp;';
				if(Jes.request('num')==1) h='';
				Jes.html('pBTxt','<p><font color="red">'+_d.procInfo+'</font></p><p>'+h+'<input type="button" value="关 闭" onclick="Jes.close();"/></p>');
				//Jes.hide("eBar");
				Jes.disBtn(false);
			}
	    });
	}
	//upload_response.jsp
	,callBack : function(data){
		var req = Jes.request(),_w=req.width,_h=req.height,id=req.id,cb=req.cb,cbEl=req.cbEl,_opener = Jes.opener(),taEl=_opener.Jes(id),tr,td;
		if(cb){
			eval('_opener.'+cb+'(data);');
		}
		if(taEl){
			try{
				if(req.type=='img' && 'gif|jpg'.indexOf(data.type) != -1){
					var style = Jes.isNull(_w)?'':' width="'+_w+'" height="'+_h+'"';
					tr = Jes.Table.newTr(taEl);
					td = Jes.Table.newTd(tr,{align:'center'},null,'<img src="'+data.httppath+'img/'+data.name +'" '+style+'><input type="hidden" id="'+id+'.upname" name="'+id+'.upname" value="'+data.name+'"/>');
					td = Jes.Table.newTd(tr,{align:'center'},null,'<input type="button" value="删除" style="border:1px soild #000000;font-size:10px;" onclick="Jes.Upload.del(this,\''+data.id+'\',\''+data.name+'\',\''+cbEl+'\');"/>');
					if(cbEl) _opener.Jes.val(cbEl,data.name);
				}else{
					tr = Jes.Table.newTr(taEl);
					td = Jes.Table.newTd(tr,{align:'center',height:'30px',bgColor:'#ffffff'},null,'<a href="../../download.shtml?name='+data.name+'&oldName='+data.oldname+'&isTemp=true">'+data.oldname+'</a>');
					td = Jes.Table.newTd(tr,null,null,data.upsize);
					td = Jes.Table.newTd(tr,null,null,Jes.curDate());
					td = Jes.Table.newTd(tr,null,null,'<input type="button" value="删除" style="border:1px soild #000000;font-size:10px;" onclick="Jes.Upload.del(this,\''+data.id+'\',\''+data.name+'\');"/>');
				}
		    }catch(e){
				alert("获得附件信息失败，请联系管理员。");
			}
		}
	}
});
//--------------------------------------------------------------------------------------------------------------------------------------------------
</script>


</head>
<body onload="Jes.Upload.init();">
<br>
<center>
<form name="form1" method="post" action="" enctype="multipart/form-data" onsubmit="" target="response_iframe">
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="kuang3" style="margin-top:20px">
	<tr>
		<td bgcolor="#8abb2d">
			<table width="100%" border="0" cellpadding="5" cellspacing="1">
				<tr><td align="center" bgcolor="#f5fbec" colspan="2"><strong id="tit">附件上传</strong></td></tr>
	  			<tr>
	    			<td align="center" bgcolor="#f5fbec">请选择文件</td>
	    			<td bgcolor="#ffffff"><input type="file" size="40" id="attachfile" name="attachfile"></td>
	  			</tr>
	  			<tr align="center" bgcolor="#ffffff">
		    		<td colspan="2">
						<input type="button" name="ok" name="ok" value="确 定" class="button" onclick="Jes.Upload.upload();">&nbsp;&nbsp;
						<input type="button" name="close" name="close" value="关 闭" class="button" onclick="Jes.close();">
						<div id="picinfo"></div>
					</td>
	    		</tr>
			</table>
		</td>
	</tr>
</table>
<div id="pBar" align="left" style="width:400px;height:180px;border:0px;background-image:url(images/bg.gif);display:none;position:absolute;top:10px;left:100px;">
	<div id="theMeter">
		<div id="pBTxt" align="center" style="width:220px;height:30px;margin-left:157px;margin-top:50px;font-size:12px;"></div>
		<div id="pBBox" style="width:216px;margin-left:160px;margin-top:40px;background-image:url(images/white.gif);height:12px;background-repeat:no-repeat;">
			<div id="pBBCont" style="background-image:url(images/blue1.gif);width:0px;height:12px;background-repeat:repeat-x;"></div>
  	    </div>
	</div>
</div>
</form>
</center>
<iframe id="response_iframe" name="response_iframe" style="display:none"></iframe>
</body>
</html>